#include<iostream>
using namespace std;

#define n 20
class queue{
    int front;
    int back;
    int*arr;
    public:
        queue(){
            arr=new int[n];
            front=-1;
            back=-1;
        }
        void push(int x){
            if(back==n-1){
                cout<<"Queue Overflow"<<endl;
            }
            back++;
            arr[back]=x;
            if(front==-1){
                front++;
            }
        }

        void pop(){
            if(front==-1 || front>back){
                cout<<"No elements in queue"<<endl;
            }
            front++;
        }
        int peek(){
            if(front==-1 || front>back){
                cout<<"No elements in queue"<<endl;
            }
        return arr[front];
        }
        bool empty(){
             if(front==-1 || front>back){
                return true;
            }
            return false;
        }

};

int main(){
    queue q;
    q.push(1);
    q.push(2);
    q.push(3);
    q.push(4);
    cout<<q.peek()<<endl;
    q.pop();
    cout<<q.peek()<<endl;
    q.pop();
    cout<<q.peek()<<endl;
    q.pop();
    cout<<q.peek()<<endl;
    q.pop();
    cout<<q.empty()<<endl;



}
